﻿/****************************************************************************************************
 * @authors: Paweł Lew-Kiedrowski & Mateusz Łajming
 * based on Google Street View viewer for the Oculus Rift by troffmo5 http://github.com/troffmo5
 *
 * VIRTUAL WALK Help functions
 ****************************************************************************************************/

function angleRangeDeg(angle) {
    angle %= 360;
    if (angle < 0)
        angle += 360;
    return angle;
}

function angleRangeRad(angle) {
    angle %= 2 * Math.PI;
    if (angle < 0)
        angle += 2 * Math.PI;
    return angle;
}

function deltaAngleDeg(a, b) {
    return Math.min(360 - (Math.abs(a - b) % 360), Math.abs(a - b) % 360);
}